package Server.ServerCore.Controller;

import Server.ServerCore.Model.Player.PlayerInstance;
import Server.ServerCore.Service.DataPacks.packRespose.MD5Key;
import Server.ServerCore.Service.Logic.HandleController;
import Server.ServerCore.Service.Logic.RegisterPack;
import Server.ServerCore.Service.service.PlayerManagerService;
import org.jboss.netty.buffer.ChannelBuffer;
import org.springframework.stereotype.Service;

/**
 * @author :石头哥哥<br/>
 *         Project:21Server
 *         Date: 13-4-19
 *         Time: 下午11:28
 *
 *         MD5加密串
 */
@Service
public class KeyController extends HandleController {
    /**
     * 数据分解具体处理的函数
     *
     * @param buffer buffer
     * @param player player
     */
    @Override
    public void DispatchPack(ChannelBuffer buffer, PlayerInstance player) throws Exception {
        MD5Key md5Key=new MD5Key();
        md5Key.setKey(PlayerManagerService.getMD5());
        player.DirectSend(md5Key.getJsonData(1,0));
    }
    /**
     * 通过spring产生处理数据的controller，储存在数组中
     */
    @Override
    public void InitiController() {
        RegisterPack.GAME_CONTROLLERS[10]=this;
    }
}
